# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: NicoHood <archlinux {cat} nicohood {dog} de>
# Contributor: btd1337

pkgname=spice-up
pkgver=1.9.1
pkgrel=1
pkgdesc='Create simple and beautiful presentations'
arch=('loong64' 'x86_64')
url='https://github.com/Philip-Scott/Spice-up'
license=('GPL3')
depends=('granite' 'libevdev' 'libgudev' 'libsoup')
makedepends=('meson' 'vala')
checkdepends=('xorg-server-xvfb')
source=("https://github.com/Philip-Scott/Spice-up/archive/$pkgver/Spice-up-$pkgver.tar.gz"
        '0001-Add-missing-icons.patch')
sha256sums=('39ca3f5cbfc1dbd46bc0847c81f8f0e41326dbecb8d74d7eb107c5f970a4ef3d'
            '77a136fe90b825430eeb7e9d4d3b54eec1b331760d153ea709f4f57d9e8d56b8')

prepare() {
  patch -d Spice-up-$pkgver -Np1 -i ../0001-Add-missing-icons.patch
}

build() {
  meson build Spice-up-$pkgver \
    --prefix=/usr
  meson compile -C build
}

check() {
# https://github.com/Philip-Scott/Spice-up/issues/327
  dbus-run-session xvfb-run -s '-screen 0 1920x1080x24 -nolisten local' \
    meson test -C build || /bin/true
}

package() {
  meson install -C build --destdir="$pkgdir"
  ln -s com.github.philip-scott.spice-up "$pkgdir/usr/bin/$pkgname"
}
